package com.graduate.game.shop.controller;
import com.graduate.game.shop.pojo.goods;
import com.graduate.game.shop.service.goodsService;
import com.graduate.game.xiaogame.pojo.unkonwn;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Controller
@ResponseBody
@RequestMapping("/goods")
@CrossOrigin(origins = "*", maxAge = 3600)
public class goodsController {

    @Autowired
    public goodsService goodsservice;
    @RequestMapping("/getAll")
    public List<goods> getAll(HttpServletRequest request, HttpServletResponse response) throws Exception {
        response.setHeader("Access-Control-Allow-Origin","*");
        List<goods> goods = goodsservice.getallgoodsGoods();
        System.out.println(goods);
        return goods;
    }
}
